package com.j283_5.wisdom_park.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.j283_5.wisdom_park.vo.device_management.DeviceInformationVo;
import com.j283_5.wisdom_park.vo.device_management.DeviceVo;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * <p>
 * 
 * </p>
 *
 * @author laoda
 * @since 2022-04-28
 */
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Device implements Serializable {


    /**
     * 设备信息id
     */
    @TableId(value = "dinf_id", type = IdType.AUTO)
    private Integer dinfId;

    /**
     * 设备名称
     */
    private String ddetName;

    /**
     * 设备编号
     */
    private String ddetNumber;

    /**
     * 设备型号
     */
    private String ddetType;

    /**
     * 设备出厂时间
     */
    private Timestamp ddetFactorydate;

    /**
     * 0:正常，1：为禁用2：异常
     */
    private Integer dinfState;

    /**
     * 跟进人
     */
    private String adminName;

    /**
     * 跟进人电话
     */
    private String adminPhone;

    /**
     * 安装位置
     */
    private String dinfLocation;

    /**
     * 设备照片
     */
    private String dinfDevicephoto;

    /**
     * 现场照片
     */
    private String dinfLivephoto;
    /**
     * 厂家
     */
    private String ddetFactory;

    /**
     * 版本号
     */
    private String ddetVersion;
    /**
     * 设备类型名称
     */
    private String ddetStyle;
    /**
     * adminId
     */
    private Integer adminId;
    /**
     * adminId
     */
    @TableId(value = "ddet_id", type = IdType.AUTO)
    private Integer ddetId;

    public Integer getAdminId() {
        return adminId;
    }

    public void setAdminId(Integer adminId) {
        this.adminId = adminId;
    }

    public Integer getDdetId() {
        return ddetId;
    }

    public void setDdetId(Integer ddetId) {
        this.ddetId = ddetId;
    }

    public Device(DeviceVo deviceVo){
        this.dinfId = deviceVo.getDinfId();
        this.ddetName = deviceVo.getDdetName();
        this.ddetNumber = deviceVo.getDdetNumber();
        this.ddetType = deviceVo.getDdetType();
        this.ddetFactorydate = deviceVo.getDdetFactorydate();
        this.ddetId = deviceVo.getDdetId();
        this.adminId = deviceVo.getAdminId();
        if (deviceVo.getDinfState() != null) {
            setDinfState(deviceVo.getDinfState());
        }
        this.adminName = deviceVo.getAdminName();
        this.adminPhone = deviceVo.getAdminPhone();
        this.dinfLocation = deviceVo.getDinfLocation();
        this.dinfDevicephoto = deviceVo.getDinfDevicephoto();
        this.dinfLivephoto = deviceVo.getDinfLivephoto();
        this.ddetStyle = deviceVo.getDdetStyle();
        this.ddetFactory = deviceVo.getDdetFactory();
        this.ddetVersion = deviceVo.getDdetVersion();
    }





    public void setDinfState(String dinfState){
        switch (dinfState){
            case "正常":
                this.dinfState = 0;
                return;
            case "禁用":
                this.dinfState = 1;
                return;
            case "异常":
                this.dinfState = 2;
                return;
            default:
                this.dinfState = null;
        }
    }

    public String getDdetFactory() {
        return ddetFactory;
    }

    public void setDdetFactory(String ddetFactory) {
        this.ddetFactory = ddetFactory;
    }

    public String getDdetVersion() {
        return ddetVersion;
    }

    public void setDdetVersion(String ddetVersion) {
        this.ddetVersion = ddetVersion;
    }

    public Integer getDinfId() {
        return dinfId;
    }

    public void setDinfId(Integer dinfId) {
        this.dinfId = dinfId;
    }

    public String getDdetName() {
        return ddetName;
    }

    public void setDdetName(String ddetName) {
        this.ddetName = ddetName;
    }

    public String getDdetNumber() {
        return ddetNumber;
    }

    public void setDdetNumber(String ddetNumber) {
        this.ddetNumber = ddetNumber;
    }

    public String getDdetType() {
        return ddetType;
    }

    public void setDdetType(String ddetType) {
        this.ddetType = ddetType;
    }

    public Timestamp getDdetFactorydate() {
        return ddetFactorydate;
    }

    public void setDdetFactorydate(Timestamp ddetFactorydate) {
        this.ddetFactorydate = ddetFactorydate;
    }

    public Integer getDinfState() {
        return dinfState;
    }

    public void setDinfState(Integer dinfState) {
        this.dinfState = dinfState;
    }

    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    public String getAdminPhone() {
        return adminPhone;
    }

    public void setAdminPhone(String adminPhone) {
        this.adminPhone = adminPhone;
    }

    public String getDinfLocation() {
        return dinfLocation;
    }

    public void setDinfLocation(String dinfLocation) {
        this.dinfLocation = dinfLocation;
    }

    public String getDinfDevicephoto() {
        return dinfDevicephoto;
    }

    public void setDinfDevicephoto(String dinfDevicephoto) {
        this.dinfDevicephoto = dinfDevicephoto;
    }

    public String getDinfLivephoto() {
        return dinfLivephoto;
    }

    public void setDinfLivephoto(String dinfLivephoto) {
        this.dinfLivephoto = dinfLivephoto;
    }

    public String getDdetStyle() {
        return ddetStyle;
    }

    public void setDdetStyle(String ddetStyle) {
        this.ddetStyle = ddetStyle;
    }
}
